package org.ejde.sciencelogs;

import java.awt.event.KeyEvent;

import javax.swing.JTabbedPane;

/**
 * This class contains the attributes and behaviors for 
 * JComponents related to top-level tabbed pane.
 *  
 * @author Eric Martin
 * @version 0.1
 */
public class tabPane extends JTabbedPane {

	/**
	 * Array of tabs
	 */
	public tabPanel[] tabs;

	/**
	 * Constructor method for the tabbed panel.
	 * 
	 * @param ini configuration information
	 * @param factory formfield information
	 * @param udp UDP-based logging client
	 * @param smack XMPP-based logging client
	 */
	public tabPane(iniParser ini, fieldFactory factory, UdpXmitter udp,
			smackClient smack) {
		int Npanels = ini.panelCount();
		tabs = new tabPanel[Npanels];
		int mnemonic[] = { KeyEvent.VK_1, KeyEvent.VK_2, KeyEvent.VK_3,
				KeyEvent.VK_4, KeyEvent.VK_5, KeyEvent.VK_6, KeyEvent.VK_7,
				KeyEvent.VK_8, KeyEvent.VK_9, KeyEvent.VK_0, KeyEvent.VK_A,
				KeyEvent.VK_B, KeyEvent.VK_C, KeyEvent.VK_D, KeyEvent.VK_E,
				KeyEvent.VK_F, KeyEvent.VK_G, KeyEvent.VK_H, KeyEvent.VK_I,
				KeyEvent.VK_J, KeyEvent.VK_K };

		String Mnem = "1234567890abcdefghijk";

		for (int n = 0; n < Npanels; n++) {
			tabs[n] = new tabPanel(ini, factory, udp, smack, n);
			this.addTab(ini.getPanelAttribute(n, "name"), tabs[n]);
			this.setMnemonicAt(n, mnemonic[n]);
			this.setToolTipTextAt(n, "Alt+" + Mnem.charAt(n));
		}
	}
}
